<?php
$box_title= "Messages Management";

$box_contents  = "<div align=\"right\" class=\"top\"><a href=\"index.php?m=messages&a=addedit\">New Message</a></div>";
$box_contents .= "<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\"  align=\"center\">";

$temp =  sql_query("SELECT * FROM messages ORDER BY id DESC");
while($res = sql_fetch_row($temp)) {
    $box_contents .= "<td> &raquo; <a href=\"index.php?m=messages&a=view&id=".$res['id']."\">".substr(strip_tags($res['message']), 0, 30)."</a></td>";
    $box_contents .= "<td align=\"right\">";
    $box_contents .= "<a href=\"index.php?m=messages&a=addedit&id=".$res['id']."\">[Edit]</a> ";
    $box_contents .= "<a onclick=\"javascript: return confirm('Are you sure to delete?');\" href=\"index.php?m=messages&a=delete&id=".$res['id']."\">[Delete]</a> ";
    $box_contents .= "</td></tr>";
}
$box_contents .= "</table>";
?>